package com.xmgong.hxdemo.chatmodule.pages.conversation;

import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMConversation;

import java.util.Map;

/**
 * Created by xmgong on 2017/8/16.
 */

public class ConversationPrsent implements ConversationContract.IPresent {

    private ConversationContract.IView mview;


    public ConversationPrsent(ConversationContract.IView view) {
        this.mview = view;
    }


    @Override
    public Map<String, EMConversation> getConversationLst() {
        Map<String, EMConversation> conversations = EMClient.getInstance().chatManager().getAllConversations();
        return conversations;
    }

    @Override
    public void delConversation(String username, boolean delmessage) {
        //删除和某个user会话，如果需要保留聊天记录，传false
        EMClient.getInstance().chatManager().deleteConversation(username, delmessage);

    }

    @Override
    public void delMessage(String username, String messageid) {
        //删除当前会话的某条聊天记录
        EMConversation conversation = EMClient.getInstance().chatManager().getConversation(username);
        conversation.removeMessage(messageid);
    }
}
